#include<vector>
#include<algorithm>
using namespace std;

int triangleNumber(vector<int>& nums) {
    int ret = 0;
    sort(nums.begin(), nums.end());
    for (int i = nums.size() - 1; i >= 0; i--)
    {
        int left = 0, right = i - 1;
        while (left < right)
        {
            if (nums[left] + nums[right] > nums[i])
            {
                ret += right - left;
                right--;
            }
            else
            {
                left++;
            }
        }
    }
    return ret;
}

int main()
{


	return 0;
}